import datetime
import random
import time
import scrapy
import logging

class DnfSpider(scrapy.Spider):
    name = "DNF"
    allowed_domains = ["dnf.qq.com"]
    start_urls = ["https://dnf.qq.com/web2015/down.shtml"]

    def start_requests(self):
        for url in self.start_urls:
            yield scrapy.Request(url, callback=self.parse)

    def parse(self, response):
        time.sleep(random.uniform(1, 3))
        logging.warning('------------警告内容------------： ')

        with open(r'./dnf.html', 'wb+') as f:
            f.write(response.body)
        pass
